package com.user.command;

import java.util.HashMap;
import java.util.Map;

public class SystemCommandFactory extends AbstractCommandFactory {
	private static Map<String, Command> cmdMap = new HashMap<String, Command>();

	static {
		cmdMap.put(CommandEnum.LOGIN.name(), new LoginCommand());
		cmdMap.put(CommandEnum.SIGNUP.name(),new SignupCommand());
		cmdMap.put(CommandEnum.EXIT.name(), new ExitCommand());
		cmdMap.put(CommandEnum.HELP.name(),new HelpCommand());
		
	}

	@Override
	public Command buildCommand(String cmd) {
		if (cmdMap.get(cmd) != null) {
			Command command = cmdMap.get(cmd);
			return command;
		}else {
			return new HelpCommand();
		}
	}
}
